UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OPv/uUizmLiX4ZpZhDEnr33WG5wls/g0n1Pnyp4Ldt8=' 
WHERE 
  key_id = 'c011355bb41915ad30438a8c84d254f8372ec745720eab21dfa99776e18e6016' 
  AND (
    token = 'OPv/uUizmLiX4ZpZhDEnr33WG5wls/g0n1Pnyp4Ldt8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037