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