UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'InWm2a/c0lKn9nc37OUfNkib2pmixIx9xv+mgoSe4Co='
WHERE
key_id = '4a9e4f5506a587a8522b8b84db8c0ce37f84597e47ff31c271f16d778bb2f4ee'
AND (
token = 'InWm2a/c0lKn9nc37OUfNkib2pmixIx9xv+mgoSe4Co='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)