UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KV5brJcnRj5j6Cd+pvXrsoOjuXOv2RW+gd0N61Njt8E='
WHERE
key_id = 'cff1bf120802b586a11cb004638d65e286fbd13c920d5e4d627264a47ee84d7a'
AND (
token = 'KV5brJcnRj5j6Cd+pvXrsoOjuXOv2RW+gd0N61Njt8E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)