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