UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'G6wS3jDQlxc05CiWGtY/kTfUAVRuDH6C4MkT4JaTT0A='
WHERE
key_id = 'fa360b0d36d12807128c99b84fe0ba43a0f3a05d3c5b29244325554bd4a5e096'
AND (
token = 'G6wS3jDQlxc05CiWGtY/kTfUAVRuDH6C4MkT4JaTT0A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)