UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BH3pCQsW607y6Mt2+i4YTFhACA5wUWJjOmslF0ZrI4g='
WHERE
key_id = 'a9db0451c8878faade5e3d3ac937d4f71509fd89ae00d699002a90b98c84d8f7'
AND (
token = 'BH3pCQsW607y6Mt2+i4YTFhACA5wUWJjOmslF0ZrI4g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)