UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ccONnu2vGIwUgEViZruwHm5si6UwjxhB4V5dmNJqUR4='
WHERE
key_id = '8e9f8ade1cc5f909d934688e0897f627593c0c780da15c12676e5b9031e9af14'
AND (
token = 'ccONnu2vGIwUgEViZruwHm5si6UwjxhB4V5dmNJqUR4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)