UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ytCmQZnhVvuluI3I1ucGFOv6pniUYZ9tjsaRzD+z61w=' 
WHERE 
  key_id = '25468bc3c9a303f9d14cf6cf5505f017281bb5fa78c5ac65c36c2c1f4ed0734d' 
  AND (
    token = 'ytCmQZnhVvuluI3I1ucGFOv6pniUYZ9tjsaRzD+z61w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041