UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jzooViDo2HJnVTjLn2OtudzPvypYS1yEdxwr48QjVr8='
WHERE
key_id = 'ac9f6828c02c231601da10d9fab0408d37f4318ec457bb49eb6f3b4f539f1d0e'
AND (
token = 'jzooViDo2HJnVTjLn2OtudzPvypYS1yEdxwr48QjVr8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)