UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XO/gO4U7RP/lDzfN0Ozu8Xg9mcQjcPkPv9tvmRQAz8k='
WHERE
key_id = 'a6d7adfe1174e46310d3b9092073c58327c34354274f8870f23c1efe684df45f'
AND (
token = 'XO/gO4U7RP/lDzfN0Ozu8Xg9mcQjcPkPv9tvmRQAz8k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)