UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QXFY3NwL9UxG5uQJUJsx7g1rUYIyQtRFJxrYrliqWCQ=' 
WHERE 
  key_id = '56ae909f360401511cd91016e5bf4852ca90e91a79fbe9d31c1dc9647238e788' 
  AND (
    token = 'QXFY3NwL9UxG5uQJUJsx7g1rUYIyQtRFJxrYrliqWCQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035