UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KVXfFxla2aoX27wbkRsdSu/VYcSmEDRKvNFQTak9qLE=' 
WHERE 
  key_id = '8f650304e106ec20219cb0988bd3b721b9b26e8d16ea9d9b3876a16749b84422' 
  AND (
    token = 'KVXfFxla2aoX27wbkRsdSu/VYcSmEDRKvNFQTak9qLE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031