UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wicHJRj78oQqAsNLakNUBb2LaDBS9RHxluTJpMw0EdQ=' 
WHERE 
  key_id = '10708f1fda272b152b5a3a7046d80196ca13a57695821c3f22cfac13d366f58a' 
  AND (
    token = 'wicHJRj78oQqAsNLakNUBb2LaDBS9RHxluTJpMw0EdQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023