UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'y3G6S152DjsTuGmpLFudtwRmZxNjiwVOkzzMQgW8o1o=' 
WHERE 
  key_id = '662e3f80f8eb7ea974c8f4b43ce85447f24e0c2e84ad683c9a79fad18a5d795b' 
  AND (
    token = 'y3G6S152DjsTuGmpLFudtwRmZxNjiwVOkzzMQgW8o1o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023