UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'M35vhMGB89bYl2C869hrOle+WWYmQY78kaA+drkDq84='
WHERE
key_id = '8346e5f8a0b5271ca19ce895d4542ad36afa36ed2673ecd9cddfa43b9c823664'
AND (
token = 'M35vhMGB89bYl2C869hrOle+WWYmQY78kaA+drkDq84='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)