UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6VhjHxSqU1TUp6qBIWK2xpRvYdXY0KMMW85KcOAx7mY=' 
WHERE 
  key_id = '601e4ca8e9a430f1f453ccfb133a651efd54a613b2045a0bf5c8d061bb819f23' 
  AND (
    token = '6VhjHxSqU1TUp6qBIWK2xpRvYdXY0KMMW85KcOAx7mY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026