UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'J1z/Eq6xYp9YWe+IqftOtaQGaBfApuY8DsgABHvnAXE=' 
WHERE 
  key_id = '2de1252ca7215913ef4e0b29fe067136c348bb3fe95a444dc1efbb7ba52a114a' 
  AND (
    token = 'J1z/Eq6xYp9YWe+IqftOtaQGaBfApuY8DsgABHvnAXE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021