UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ivy8iDDv9yig7+pi1NFYG1inAKfgBGH0qPMtO7G3RiQ='
WHERE
key_id = 'a0e385f941728cd29c3c57d35579b688c01cd16e24015a466813d5a6114bd6e6'
AND (
token = 'Ivy8iDDv9yig7+pi1NFYG1inAKfgBGH0qPMtO7G3RiQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)