UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'q4qLbmr67mWs2L5o2gNZecBEInA2ipQFZXcRHbeQv2c=' 
WHERE 
  key_id = '2877d57a152806be47e8af2fccd809f029da994637df6feffd17067b16ac8dba' 
  AND (
    token = 'q4qLbmr67mWs2L5o2gNZecBEInA2ipQFZXcRHbeQv2c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043