UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'b32BRfw+wa3g4BuyHEjbyeKE07woe8GZYjmnNGvWN6Y='
WHERE
key_id = 'dbf8784fc1f329a9ea52e8ab2ade0bdffbffa57333f3715f164b03eecdb8f6ce'
AND (
token = 'b32BRfw+wa3g4BuyHEjbyeKE07woe8GZYjmnNGvWN6Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)