UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Mt2O2PgY83Mg6Pl5k5c2uUwUvoygPpz0yBONHfxFOb0=' 
WHERE 
  key_id = 'b74516423fe0531f762440fb5136e4d41df088da931dfee476494e4b8216c6f2' 
  AND (
    token = 'Mt2O2PgY83Mg6Pl5k5c2uUwUvoygPpz0yBONHfxFOb0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049