UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ru7KQeebUOI3NNUv6gcr73bR28DAQQ2DaBxSCtEh97A=' 
WHERE 
  key_id = '1b864ef42332d3296dfb93bd3e335240b2a5abfe85a7dca08633a055b5cce221' 
  AND (
    token = 'ru7KQeebUOI3NNUv6gcr73bR28DAQQ2DaBxSCtEh97A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042