UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ILD03WmjOqcEOYtt7QqxpYOjwmBDrmHNH6PbQJWyE58='
WHERE
key_id = '5b4cb1a9dd6f8a489d27e399e4626a58716965247728d15c155d3e1eeb92b000'
AND (
token = 'ILD03WmjOqcEOYtt7QqxpYOjwmBDrmHNH6PbQJWyE58='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)