UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mSh5UQ5mkor/kseE23nkkOmymZ3zh5OcWaJ0ONYIasY=' 
WHERE 
  key_id = '6d9ac1e322373e162896e9352421717d1bb91e3dcc2edc42ad8edf1e37638403' 
  AND (
    token = 'mSh5UQ5mkor/kseE23nkkOmymZ3zh5OcWaJ0ONYIasY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053