UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yyf1gQ0K6a8SRoV570bdx0vREbIkfIdgh/AkivvynzE=' 
WHERE 
  key_id = '3167480e7a24c7ed27cf2743d0d1f7086a40f7b61c5df1898c4546ce3ab66366' 
  AND (
    token = 'yyf1gQ0K6a8SRoV570bdx0vREbIkfIdgh/AkivvynzE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047