UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Z46ELtPHLRXGBGhYy/qhDR604RucUsTL+j7XEO3yLHs='
WHERE
key_id = 'a04d7326335b206169fb972eb570ab6a531fdb655af18aca3ab9db22828a9965'
AND (
token = 'Z46ELtPHLRXGBGhYy/qhDR604RucUsTL+j7XEO3yLHs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)