UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Zr4zustIb29yz/05XUekwaALRUSldyBiiSKvry/PmVg=' 
WHERE 
  key_id = 'cc27039831ba5d4a1411e823661c565015077d58afcffd9583d35ec1117c2db3' 
  AND (
    token = 'Zr4zustIb29yz/05XUekwaALRUSldyBiiSKvry/PmVg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025