UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tZ6de+wbV8I4BsTTPAtgDvs9u/qjJbh7UHSHewU941I='
WHERE
key_id = '29860c1af32e34e8c8db85b8a8892e1bafd9690eda7d94537a1cfb309b0221bb'
AND (
token = 'tZ6de+wbV8I4BsTTPAtgDvs9u/qjJbh7UHSHewU941I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)