UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'knNX6L7r136m8opea3jKI00cfhodvT85yuV85GQlI0M='
WHERE
key_id = 'f56f7124943b9c1c93488989fa029e6f97e95df2fc8d6664a7c7ce4a520b9bb4'
AND (
token = 'knNX6L7r136m8opea3jKI00cfhodvT85yuV85GQlI0M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)