UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eN5XHzZcNbKQWv9nRbAc8ut5yKfIyAl9F8gzJbOJZyU=' 
WHERE 
  key_id = '7d316dc36bd89044e9c836f6f7d108bf9c9c8156ea21a548077e74b7640a1391' 
  AND (
    token = 'eN5XHzZcNbKQWv9nRbAc8ut5yKfIyAl9F8gzJbOJZyU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028