UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9sSB5P7/oJy/4Gn5X0dGxrlAElYeSlvS1GXHF7hjeXM='
WHERE
key_id = '848ab88963e7a6a3fb7567b3dedde9bd229ab12510f8252ce90daf472572c342'
AND (
token = '9sSB5P7/oJy/4Gn5X0dGxrlAElYeSlvS1GXHF7hjeXM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)