UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'U33Pm57M0gWgtaCc7XI4LdXusBPAefcYhLbToVVXgps=' 
WHERE 
  key_id = '0691ea7e0e892dd6f71e87f6ceaea5c84f88d56a3a19cccec7a730ca8036d723' 
  AND (
    token = 'U33Pm57M0gWgtaCc7XI4LdXusBPAefcYhLbToVVXgps=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024