UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZM+4wb48zstF2qVl6+br6tXKFyz/s/qDPCS+HUyHkOM='
WHERE
key_id = '6ed8c501ceb91858e8bc9a61e8dfa1437cda16e58a683e54c4de7fb0be16d08a'
AND (
token = 'ZM+4wb48zstF2qVl6+br6tXKFyz/s/qDPCS+HUyHkOM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)