UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZPu47kDYuzh0pWdMM62c4C7n4Mtb68+aeHm7B1QtStk='
WHERE
key_id = 'e84a5de1535767c9cc4b29897a34e06947c38e33ac6cd53a5d5d9510a640e68f'
AND (
token = 'ZPu47kDYuzh0pWdMM62c4C7n4Mtb68+aeHm7B1QtStk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)