UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Rtr61CjzlMnTgq9QjuCq6HA5jiwM2dyEw8x0DuHwC6M=' 
WHERE 
  key_id = 'ee88433263d954272b3174e365996b7731a167c401e10ced604a058855506f67' 
  AND (
    token = 'Rtr61CjzlMnTgq9QjuCq6HA5jiwM2dyEw8x0DuHwC6M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027