UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '48TpxbExYyDrRTsx6ffa5SGOli2NnICqUGbU3rvmIH8='
WHERE
key_id = 'b82be50dec1dd470bdbc07016a08dd048bebc5f10ac7bb718dbdb7369123ceb0'
AND (
token = '48TpxbExYyDrRTsx6ffa5SGOli2NnICqUGbU3rvmIH8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)