UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mgw4fy9NAx6JZqiO07A5S6KixyJw/dU/LGNROf6v8Hk='
WHERE
key_id = '8fb7dc87a05108e1e90f1163563be8cb34abdfee5cad881842fb041a4e4804f1'
AND (
token = 'mgw4fy9NAx6JZqiO07A5S6KixyJw/dU/LGNROf6v8Hk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)