UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bQcHF5WMkwOQnrQQKN6WIbmNGZKAHryg1huUAtWdkjM='
WHERE
key_id = 'dc058d8690eb955b05599df7580b3704438039f584a216eaff3afce4a77a18a3'
AND (
token = 'bQcHF5WMkwOQnrQQKN6WIbmNGZKAHryg1huUAtWdkjM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)