UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dTZB4j59cSVf6svBymJ1sGNNeF+9MuWQG2uAZyNwhk8='
WHERE
key_id = 'd736642791c8ab084ca77f6f28505a19b646e88ee51b11f83874798d291e3ffc'
AND (
token = 'dTZB4j59cSVf6svBymJ1sGNNeF+9MuWQG2uAZyNwhk8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)