UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '97hmpejix6i1VXRksTW6jzZPZzxjjz4gn8+HfMF4+2w='
WHERE
key_id = 'e627941d396b2e723d2fed91f93ae0e8491e6246efbf1a879baffd1b2769e937'
AND (
token = '97hmpejix6i1VXRksTW6jzZPZzxjjz4gn8+HfMF4+2w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)