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