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