UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Zr6ihV58TtFu8PnFkriWxJeMTT7wU9iA1hAax/Air5k='
WHERE
key_id = 'bc07fefb923c0306d1d24e8cf4363a45413dccf0049f927e36990a0c65977b9b'
AND (
token = 'Zr6ihV58TtFu8PnFkriWxJeMTT7wU9iA1hAax/Air5k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)