UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'df6JUn+CPqOWjmGbnw1Zdvpw9EF1AENaKVMEypum9IM=' 
WHERE 
  key_id = 'b4222b70fa1fcf415819802c932b997b6db762bbb34f86960562d69979320541' 
  AND (
    token = 'df6JUn+CPqOWjmGbnw1Zdvpw9EF1AENaKVMEypum9IM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020