UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZN6aDd8JrXQ48AkfLdZDdhWuKets+TOrL/ZP1KOeyCE=' 
WHERE 
  key_id = '9900bde337bdd77afd9ec3b0df1d384bdf73fa8c1fc7274c552d1696dbbd0d65' 
  AND (
    token = 'ZN6aDd8JrXQ48AkfLdZDdhWuKets+TOrL/ZP1KOeyCE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043