UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gU5NLKCJwqPAdjVDEYbPBfQ6gKD1b/ZJ4lRFLqbh2Fs=' 
WHERE 
  key_id = '45e198c86903f7c2fca2a508fbbfb600c86817614d2d91e6a5797582f3fe40e8' 
  AND (
    token = 'gU5NLKCJwqPAdjVDEYbPBfQ6gKD1b/ZJ4lRFLqbh2Fs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035