UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qw440RfQpg+wkpuVOuQc5olsKLzhu/qvWuB0J9VCMVQ=' 
WHERE 
  key_id = '545f9c90e712d32130c5e6b29fc5df26b9a330e086459c2c79c994fa89285225' 
  AND (
    token = 'qw440RfQpg+wkpuVOuQc5olsKLzhu/qvWuB0J9VCMVQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023